<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html> 
<head>
<%@ include file="/WEB-INF/jsp/include/easyui.jsp" %>
<%@ include file="/WEB-INF/jsp/include/pGrid.jsp" %>
<%@ include file="/WEB-INF/jsp/include/pForm.jsp" %>
<title>菜单移动</title>
<script>
	$(function(){
		/*标记列表为树形*/
		p.isTreeGrid = true;
		p.dataGrid = $(p.dataGrid).treegrid($.extend({},p.dataGridParam,{
			url: "/console/menu/list" ,
			columns: [[
		         {field:'menuName', width:300, title:'菜单名称' }
			]],
			lines: true,
			idField: 'treeId', 
			treeField: 'menuName',
			singleSelect: true, 
			pagination: false,
			queryParams:{isTreeGrid:"true", treeId:"id", treePid:"parentId" },
			onSelect: function(row){
				if(fn.data.id==row.id){
					p.dataGrid.treegrid("unselect",row.id);
					p.dataGrid.treegrid("select",row.parentId);
				}else{
					$("input[name=parentId]").val(row.id);
				}
			},
			onLoadSuccess:function(data){
				p.dataGrid.treegrid("select",fn.data.parentId);
			}
		}));
		
		$("#toolbar .easyui-linkbutton").on("click", function() {
			var id = $(this).attr("id");
			switch(id){
				case "b_5": p.gridQuery();break;
				default:break;
			}
		});
		fn.resetForm();
		
		//fn.data.id
		
	});
</script>
</head>
<body>
	<div class="easyui-panel" data-options="fit:true,border:false" style="padding:0px;">
		<form id="easyuiForm" method="post" action="/console/menu/move"  style="display: none;" >
			<input type="hidden" name="id" value="" />
			<input type="hidden" name="parentId" value="" />
		</form>		
		<!-- 工具栏 -->
		<div id="toolbar" class="easyui-panel" style="padding:3px;">
			<!-- 工具栏按钮  -->
	      	<a href="#" class="easyui-linkbutton" iconCls="icon-reload" plain="true" id="b_5">刷新</a>
		</div>
		
		<!-- 表格 --> 
		<table id="dataGrid"></table>
	
	</div>
</body>
</html>